<template>
  <div class="main_box" style="padding:10px;">
    <div class="detail_wrap">
      <div class="tit">
        <h2>康 来 子 项 目 信 息</h2>
        <el-button
          type="success"
          plain
          size="small"
          icon="fa fa-mail-forward"
          @click="returnList"
        >
          返 回</el-button
        >
      </div>
      <div class="con">
        <ul>
          <li>
            <label class="label">子项目名称:</label>
            <span>{{ dataInfo.subItemName }}</span>
          </li>
          <li>
            <label class="label">子项目别称:</label>
            <span>{{ dataInfo.subItemShortName }}</span>
          </li>
          <li>
            <label class="label">子项目编号:</label>
            <span>{{ dataInfo.subItemCode }}</span>
          </li>
          <li>
            <label class="label">当前状态:</label>
            <span>{{ dataInfo.state | filterState }}</span>
          </li>
          <li>
            <label class="label">收费价格:</label>
            <span>{{ dataInfo.subItemPrice | priceState }}</span>
          </li>
          <li>
            <label class="label">临床意义:</label>
            <span>{{ dataInfo.subItemMeaning }}</span>
          </li>
          <li>
            <label class="label">注意事项:</label>
            <span>{{ dataInfo.subItemNote }}</span>
          </li>
          <li>
            <label class="label">创建人:</label>
            <span>{{ dataInfo.createUserName }}</span>
          </li>
          <li>
            <label class="label">创建时间:</label>
            <span>{{ dataInfo.createDate }}</span>
          </li>
          <li>
            <label class="label">最后一次修改:</label>
            <span
              >{{ dataInfo.modifyUserName }} / {{ dataInfo.modifyDate }}</span
            >
          </li>
        </ul>
      </div>
      <div class="tit">
        <h2>关 联 康 来 项 目 组 列 表</h2>
      </div>
      <el-table
        :data="tableData"
        highlight-current-row
        :header-cell-style="{'background-color':'#f2f2f2'}"
        style="width: min-content;;margin: 20px 0;">
        <el-table-column
        type="index"
        width="80px"
        align="center"
        label="序号">

        </el-table-column>
         <el-table-column
          prop="itemId"
          label="项目组ID"
          width="180"
          align="center">
        </el-table-column>
        <el-table-column
          prop="itemCode"
          label="项目组编号"
          width="180"
          align="center">

        </el-table-column>
        <el-table-column
          prop="itemName"
          label="项目组名称"
          width="300"
          align="center">

        </el-table-column>
        <el-table-column
          prop="itemShortName"
          label="项目组别称"
          width="180px"
          align="center">

        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import ReportItemApi from "@/api/report/reportItem";
export default {
  data() {
    return {
      dataInfo: [],
      tableData: []
    }
  },
  filters: {
    filterState(value) {
      // 状态 -1.删除 0.禁用 1.启用
      if (value == 1) {
        return "启用中";
      } else if (value == 0) {
        return "已禁用";
      } else if (value == -1) {
        return "已删除";
      }
    },
    priceState(value) {
      if (value) {
        return value + "元";
      } else {
        return "未填写";
      }
    }
  },
  methods: {
    getData() {
      ReportItemApi.getReportSubItem({ subItemId: this.$route.query.id }).then(
        res => {
          this.tableData = res.data.items
          this.dataInfo = res.data;
        }
      );
    },
    returnList() {
      //   this.$router.push({ path: '/report/itemManagement' })
      // this.$router.go(-1)
      this.$store.dispatch("delView", this.$route);
      this.$router.push({ path: "/item/reportSubItemManagement" });
    }
  },
  mounted() {
    this.getData();
  }
};
</script>
<style lang="scss" src="@/assets/css/views/Detail.scss" scope></style>
